﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="collaboration_type_edit.aspx.cs" Inherits="Ccit.Mgoa.Collaboration.collaboration_type_edit" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>协作类型编辑</title>
    <script language="javascript" type="text/javascript" src="../script/jwindow.js"></script>
    <script language="javascript" type="text/javascript" src="../script/jquery.js"></script>
    <script language="javascript" type="text/javascript" src="../script/jsonlib.js"></script>
    <script language="javascript" type="text/javascript" src="../script/jbase64.js"></script>
    <script language="javascript" type="text/javascript">
    <!--
        /* 范围选择 */
        function doRangeSelect(ctrlRangeType, ctrlRangeId, ctrlRangeName)
        {
            OpenRangeSelect(ctrlRangeType, ctrlRangeId, ctrlRangeName, ",");    
        }
        
        /* 取消 */
        function doCancel()
        {
            window.location.href="collaboration_type_index.aspx";
        }
        
        /* 保存 */
        function doSave()
        {
            if(CheckValue())
            {
                var objCollaborate=GetCollaborateObject();
                var oCollaborateStr=JSON.stringify(objCollaborate,function(key,value){return value;})
                PageMethods.SaveCollaboration(oCollaborateStr,ClientCallBack);
            }
        }
        
        /* 获得协作类型对象 */
        function GetCollaborateObject()
        {
            var oTypeId=document.getElementById("hdTypeId").value;
            var oTypeName=jQuery.trim(document.getElementById("txtTypeName").value);
            var oTypeDesc=jQuery.trim(document.getElementById("txtTypeDesc").innerText);
            var oManageRangeType=document.getElementById("hdManageRangeType").value;
            var oManageRangeId=document.getElementById("hdManageRange").value;
            var oPublishRangeType=document.getElementById("hdPublishRangeType").value;
            var oPublishRangeId=document.getElementById("hdPublishRange").value;
            var objCollaborate={};
            objCollaborate.TypeId=oTypeId;
            objCollaborate.TypeName=oTypeName;
            objCollaborate.TypeDesc=oTypeDesc;
            objCollaborate.ManagementRange=oManageRangeType;
            objCollaborate.ManagementId=oManageRangeId;
            objCollaborate.PublishedRange=oPublishRangeType;
            objCollaborate.PublishedId=oPublishRangeId;
            return objCollaborate;
        }
        
        function CheckValue()
        {
            var oFlag=true;
            var oTypeName=jQuery.trim(document.getElementById("txtTypeName").value);
            if(oTypeName=="")
            {
                oFlag=false;
                alert("协作类型名称不能为空！")
            }
            return oFlag;
        }
        
        function ClientCallBack(oResult)
        {
            if(oResult!="")
            {
                document.getElementById("hdTypeId").value=oResult;
                alert("保存成功！");
            }
            else
                alert("保存失败！");
        }
    //-->
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <input type="hidden" id="hdTypeId" runat="server" />
        <asp:ScriptManager ID="ScriptManager1" EnablePageMethods="true" runat="server"></asp:ScriptManager>
        <table border="0" cellpadding="0" cellspacing="0" align="center" width="98%" class="tbToolbar">
            <tr>
                <td align="left">
                    <div class="tbSeparator"></div>
                </td>
                <td align="left" class="titlebar" style="width:100%">
                    <nobr>
                        协作管理-协作类型编辑
                    </nobr>
                </td>
                <td align="right">
                    <div class="tbSeparatorEnd"></div>
                </td>
            </tr>
        </table>
        <table border="0" cellpadding="0" cellspacing="0" align="center" class="tableborder" runat="server" width="98%">
            <tr>
                <td style="width:100%" align="center">
                    <asp:Panel ID="Panel1" Width="95%" runat="server" BorderStyle="None" GroupingText="基本信息" HorizontalAlign="Center">
                        <table id="Table1" border="0" cellpadding="0" cellspacing="0" align="center" runat="server" width="98%">
                            <tr>
                                <td style="width:20%;border-left:1px solid" align="right" class="pformleft">
                                    类型名称：
                                </td>
                                <td style="width:80%" class="pformrightline">
                                    <nobr>
                                        <input type="text" id="txtTypeName" runat="server" class="input" style="width:60%" />
                                        <font color="red">*</font>
                                    </nobr>                                    
                                </td>
                            </tr>
                            <tr>
                                <td style="width:20%;border-left:1px solid" align="right" class="pformleft">
                                    类型描述：
                                </td>
                                <td style="width:80%" class="pformrightline">
                                    <asp:TextBox runat="server" CssClass="inputarea" ID="txtTypeDesc" Width="99.4%" TextMode="MultiLine" Rows="5"></asp:TextBox>                                    
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" class="pformright">&nbsp;</td>
                            </tr>
                        </table>
                    </asp:Panel>
                </td>
            </tr>
            <tr>
                <td style="width:100%" align="center">
                    <asp:Panel ID="Panel2" Width="95%" runat="server" BorderStyle="None" GroupingText="管理员" HorizontalAlign="Center">
                        <table border="0" cellpadding="0" cellspacing="0" align="center" runat="server" width="98%">
                            <tr>
                                <td style="width:20%;border-left:1px solid" align="right" class="pformleft">
                                    人员：
                                </td>
                                <td style="width:80%" class="pformrightline">
                                    <nobr>
                                        <asp:TextBox runat="server" ID="txtManageRange" ReadOnly="true" TextMode="MultiLine" Rows="3" CssClass="inputarea" Width="90%"></asp:TextBox>                     
                                        <%-- 存储范围值 --%>
                                        <input type="hidden" id="hdManageRange" runat="server" />
                                        <%-- 存储范围类型 --%>
                                        <input type="hidden" id="hdManageRangeType" runat="server" />
                                        <a href="javascript:doRangeSelect('hdManageRangeType','hdManageRange','txtManageRange')" class="linktext"><img src="../images/user.gif" /></a>
                                    </nobr>
                                </td>
                            </tr>
                            <tr>
                                <td style="width:20%;border-left:1px solid" align="right" class="pformleft">
                                    权限说明：
                                </td>
                                <td style="width:80%" class="pformrightline">
                                    创建、管理当前类型下所有协作
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" class="pformright">&nbsp;</td>
                            </tr>
                        </table>
                    </asp:Panel>
                </td>
            </tr>
            <tr>
                <td style="width:100%" align="center">
                    <asp:Panel ID="Panel3" Width="95%" runat="server" BorderStyle="None" GroupingText="成员" HorizontalAlign="Center">
                        <table id="Table2" border="0" cellpadding="0" cellspacing="0" align="center" runat="server" width="98%">
                            <tr>
                                <td style="width:20%;border-left:1px solid" align="right" class="pformleft">
                                    发布范围：
                                </td>
                                <td style="width:80%" class="pformrightline">
                                    <nobr>
                                        <asp:TextBox runat="server" ID="txtPublishRange" ReadOnly="true" TextMode="MultiLine" Rows="3" CssClass="inputarea" Width="90%"></asp:TextBox>                     
                                        <%-- 存储范围值 --%>
                                        <input type="hidden" id="hdPublishRange" runat="server" />
                                        <%-- 存储范围类型 --%>
                                        <input type="hidden" id="hdPublishRangeType" runat="server" />
                                        <a href="javascript:doRangeSelect('hdPublishRangeType','hdPublishRange','txtPublishRange')" class="linktext"><img src="../images/user.gif" /></a>
                                    </nobr>
                                </td>
                            </tr>
                            <tr>
                                <td style="width:20%;border-left:1px solid" align="right" class="pformleft">
                                    权限说明：
                                </td>
                                <td style="width:80%" class="pformrightline">
                                    创建、管理个人协作
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" class="pformright">&nbsp;</td>
                            </tr>
                        </table>
                    </asp:Panel>
                </td>
            </tr>
            <tr>
                <td class="pformstrip" align="center">
                    <input type="button" runat="server" id="btnSave" class="button" onclick="doSave()" value="保存" />&nbsp;&nbsp;
                    <input type="button" runat="server" id="btnCancel" class="button" onclick="doCancel()" value="取消" />
                </td>
            </tr>
        </table>
    </form>
</body>
</html>
